/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.teamreinforce.ejb.entities;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author tidiane
 */
@Entity
@Table(name = "risque")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Risque.findAll", query = "SELECT r FROM Risque r"),
    @NamedQuery(name = "Risque.findByIdRisque", query = "SELECT r FROM Risque r WHERE r.idRisque = :idRisque"),
    @NamedQuery(name = "Risque.findByRisque", query = "SELECT r FROM Risque r WHERE r.risque = :risque"),
    @NamedQuery(name = "Risque.findByProbalilite", query = "SELECT r FROM Risque r WHERE r.probalilite = :probalilite"),
    @NamedQuery(name = "Risque.findByImpact", query = "SELECT r FROM Risque r WHERE r.impact = :impact"),
    @NamedQuery(name = "Risque.findByPlanB", query = "SELECT r FROM Risque r WHERE r.planB = :planB")})
public class Risque implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "id_risque")
    private Integer idRisque;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "risque")
    private String risque;
    @Basic(optional = false)
    @NotNull
    @Column(name = "probalilite")
    private int probalilite;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "impact")
    private String impact;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 150)
    @Column(name = "plan_b")
    private String planB;
    @JoinColumn(name = "projet", referencedColumnName = "id_projet")
    @ManyToOne(optional = false)
    private Projet projet;

    public Risque() {
    }

    public Risque(Integer idRisque) {
        this.idRisque = idRisque;
    }

    public Risque(Integer idRisque, String risque, int probalilite, String impact, String planB) {
        this.idRisque = idRisque;
        this.risque = risque;
        this.probalilite = probalilite;
        this.impact = impact;
        this.planB = planB;
    }

    public Integer getIdRisque() {
        return idRisque;
    }

    public void setIdRisque(Integer idRisque) {
        this.idRisque = idRisque;
    }

    public String getRisque() {
        return risque;
    }

    public void setRisque(String risque) {
        this.risque = risque;
    }

    public int getProbalilite() {
        return probalilite;
    }

    public void setProbalilite(int probalilite) {
        this.probalilite = probalilite;
    }

    public String getImpact() {
        return impact;
    }

    public void setImpact(String impact) {
        this.impact = impact;
    }

    public String getPlanB() {
        return planB;
    }

    public void setPlanB(String planB) {
        this.planB = planB;
    }

    public Projet getProjet() {
        return projet;
    }

    public void setProjet(Projet projet) {
        this.projet = projet;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idRisque != null ? idRisque.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Risque)) {
            return false;
        }
        Risque other = (Risque) object;
        if ((this.idRisque == null && other.idRisque != null) || (this.idRisque != null && !this.idRisque.equals(other.idRisque))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.teamreinforce.ejb.entities.Risque[ idRisque=" + idRisque + " ]";
    }
    
}
